<title>Caching Support</title>
<table border="0" cellspacing="5" cellpadding="2" width="100%">
  
    <tr> 
      
    <td align="left" valign="top" bgcolor="#0080c0"> <b><font color="#ffffff" face="Arial,Helvetica"> 
      Eclipse 3.1 - Plan item</font></b> </td>
    </tr>
</table>
<h1>Generic Cache Management Support</h1>
This document outlines a proposal for a generic cache managemen facility for Eclipse 
Platform. 
<p>Last Modified: August 12th, 2004</p>
<h1>Motivation</h1>
<p>The memory footprint of Eclipse based applications can be large.</p>
<p>Tools build using Eclipse often cache data in memory to improve performance. 
  Most tools will lazily load information from disk to improve startup time and 
  ensure that memory is not used until required. However, there is often no stratgey 
  in place to free up this memory if it is used infrequently by the user. </p>
<p>Another aspect of this problem involves tools that access remote data. Caching 
  data from a remote source may involve two stages where the data is cached on 
  the local disk and in-memory. However, the local disk caching may only be to 
  persist the remote state accross restart and the in-memory data may not be freed 
  once loaded.</p>
<h1>Requirements</h1>
<p>Caching is used for several purposes. Here is a list of the types of situations 
  that require caches</p>
<ul>
  <li>Resource synchronization state</li>
  <li>Remote data such as repository content</li>
  <li>Domain models</li>
</ul>
<p>There are several characteristics to consider for the data being cached:</p>
<ul>
  <li><em>Mutable</em>: A cached object may be static or mutable. For example 
    a cache used to show the state of a remote resource would not be mutable. 
    However, a cached domain model or resource synchronization state would most 
    likely be modifiable and changes made to the model objects would need to be 
    written back to the source (most likely a file on disk).</li>
  <li><em>Computed</em>: Computed data may be cached to disk for performance. 
    The disk cache may also be considered a cache that needs to be monitored depending 
    on the cost of recomputation and how often it is used.</li>
  <li><em>Replicated</em>: (Similar to computed) Remote data may be replicated 
    on the local disk for performance. This replica is itself a type of cache 
    which could also be cleared at some point, if resources were tight or if it 
    were not used a great deal.</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h1>Proposed Solution</h1>
<p>CacheManager </p>
<ul>
  <li>consists of a set of caches</li>
  <li>runs a background job that tests caches for the need to unload some or all 
    of the cache</li>
  <li>after a run, determines when to reschedule based on state/retention policy 
    of caches</li>
  <li>will reschedule based on changes to a particular cache (i.e. if a cache 
    size grows, the job may be run immediatly to reclaim)</li>
</ul>
<p>Cache</p>
<ul>
  <li>a set of cache entries</li>
  <li>a retention policy</li>
  <li>a persistence policy (if applicable)</li>
</ul>
<p>Retention Policy</p>
<ul>
  <li>size limit: reclaim when size is exceeded based on LRU ordering.</li>
  <li>low water mark: when size is exceed, free down to low water mark.</li>
  <li>expiry time: reclaim expired entries regardless of size</li>
  <li>conditional: reclaim entries whenever a certain condition is met</li>
</ul>
<p>Persistence Policy</p>
<ul>
  <li>synchronous: batched or unbatched</li>
  <li>asynchronous: immediate or scheduled</li>
</ul>
<p>&nbsp;</p>
<p>&nbsp;</p>
</BODY>
</html>